package io.kiki.sba.registry.server.metadata.remoting;

import io.kiki.sba.registry.api.exchange.DataExchanger;
import io.kiki.sba.registry.server.metadata.bootstrap.config.ServerConfig;
import io.kiki.sba.registry.server.shared.remoting.ServerSideExchanger;
import org.springframework.beans.factory.annotation.Autowired;


public class DataNodeExchanger extends ServerSideExchanger {

    @Autowired
    private ServerConfig serverConfig;

    @Override
    public int getRpcTimeoutMillis() {
        return serverConfig.getDataNodeExchangeTimeoutMillis();
    }

    @Override
    public int getServerPort() {
        return serverConfig.getDataServerPort();
    }


    public DataNodeExchanger setMetaServerConfig(ServerConfig serverConfig) {
        this.serverConfig = serverConfig;
        return this;
    }


    public DataNodeExchanger setBoltExchange(DataExchanger boltDataExchanger) {
        this.boltDataExchanger = boltDataExchanger;
        return this;
    }
}
